<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>叩丁狼权限管理系统</title>
    <#include "../common/header.ftl" >
    <script type="text/javascript" src="/jquery/plugins/jquery.form.js" ></script>
    <script type="text/javascript" src="/jquery/plugins/jquery.bootstrap.min.js"></script>
    <!--导入日期插件-->
    <script type="text/javascript" src="/jquery/My97DatePicker/WdatePicker.js"></script>
    <style>
        /* 这样设置可以让模态框里的图片显示的宽度为模态框的宽度 */
        .modal-body img{
            width: 100%;
        }
    </style>
    <script>
        $(function () {
            // 查看文章按钮
            $(".look_Btn").click(function () {
                var id = $(this).data("json");
                //发送ajax请求,查询对应id的数据
                $.get("/travels/getById.do",{"id":id},function (data) {
                    $(".modal-body").html(" 他,神马都没有留下......");
                    $(".modal-body").html(data.content);
                })
                $("#travelModal").modal("show");
            })

            // 发布和拒绝按钮公用一个事件
            $(".changeStateBtn").click(function () {
                var travelId = $(this).data("json");
                // 游记的状态
                var state = $(this).data("state");
                $.get("/travels/changeState.do",{"id":travelId,"state":state},function (data) {
                    if(data.success){
                        $.messager.alert("温馨提示","操作成功!");
                        setTimeout(function () {
                            window.location.reload();
                        },500);
                    }
                })
            });

        })
    </script>
</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
            <#assign currentMenu="travels"/>
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记管理</h1>
                </div>

                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/travels/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <div class="form-group">
                        <label for="keyword">关键字:</label>
                        <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!}" placeholder="请输入游记标题">
                    </div>
                    <select id="auditState" class="form-control" autocomplete="off" name="state">
                        <option value="-2">全部</option>
                        <option value="1">待审核</option>
                        <option value="-1">已拒绝</option>
                    </select>
                    <script>
                        $("#auditState").val("${(qo.state)!}");
                    </script>
                    <input type="submit" id="btn_query" class="btn btn-default btn-success" value="查询">

                </form>
            </div>

            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                </tr>
                </thead>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index+1}</td>
                        <td>${entity.title}</td>
                        <td>
                            <img width="40px" height="40px" src="${(entity.headImgUrl)!}">
                        </td>
                        <td>${entity.place.name}</td>
                        <td>${(entity.author.nickName)!}</td>
                        <td>${(entity.stateName)!}</td>
                        <td>
                            <a href="javascript:void(0);" class="changeStateBtn" data-state="2" data-json="${entity.id}">发布</a>
                        </td>
                        <td>
                            <a href="javascript:void(0);" class="changeStateBtn" data-state="-1" data-json="${entity.id}">拒绝</a>
                        </td>
                        <td>
                            <a href="javascript:void(0);" class="look_Btn" data-json="${entity.id}">查看文章</a>
                        </td>
                    </tr>
                </#list>
            </table>
            <#include "../common/page.ftl" />
        </div>
    </div>
</div>
<#--查看内容模态框-->
<div class="modal fade" id="travelModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">查看内容</h4>
            </div>
            <div class="modal-body content">
                <#-- 文章内容 -->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-submit">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


</body>
</html>